<?php session_start();
require('../globals/setup.php');
$smarty = new Smarty_Kalender;	

$host  = $_SERVER['HTTP_HOST'];
if ($_SERVER['SERVER_NAME'] == 'localhost'){$uri= URI_L;}else{$uri= URI_P;}

if (!isset($_SESSION["id_user"]) || $_SESSION["id_user"]=='') {
	$url="index.php?msg=0"; 
	echo "<script language=Javascript> location.href='http://$host$uri/$url'; </script>"; 
}else{	
	
	$check_inicio = "";	
	if (!is_object($bd)){	
		//me conecto a la base de datos
		require("../globals/Db.class.php");
		require("../globals/Conf.class.php");
		$bd=Db::getInstance();	
	}
	if (!is_object($util)){	
		include("../globals/Util.class.php");		
		$util=Util::getInstance();
	}
	
	//$util->debugOn();
	

	if (!($util->administrarTiempoSesion())){
		echo "<script language=Javascript> location.href='http://$host$uri/timeout.php'; </script>";
	}else if (!($util->esCliente())){
		echo "<script language=Javascript> location.href='http://$host$uri/sinAcceso.php'; </script>";
	}
	
	
	//busco todos los datos del usuario
	$id_user = $_SESSION["id_user"];
	$query = "select razon_social from usuarios where id = $id_user";
	$result = $bd->eje($query);
	if ($row = $bd->fila($result,0)){
		$razon_social = $row["razon_social"];
	}else{
		header("Location: ");
	}
	
	$numExp = $_GET['N'];
	$smarty->assign("numero_exp", $numExp);
	$smarty->assign("razon_social", $razon_social);
	
	$menuItem = "";
	$smarty->assign("menuItem", $menuItem);
	include("../globals/menuIzquierdaClientes.php");
	
	$smarty->display("clientes/renovar.tpl");

}//del if grande ?>
